<style lang="scss">
	.flex{
		display: flex;
	}
	.mammon_input input{
		border: 1px solid #cccccc;
		text-align: center;
		width: 180rpx;
	}
	.mammon_input text{
		color: #333333;
		font-size: 28rpx;
	}
	.displace-order{
		width: 690rpx;
		margin: 0 auto;
	}
	.displace-order .d-title{
		display: flex;
		justify-content: space-between;
		align-items: center;
		color: #313131;
		font-size: 30rpx;
		height: 90rpx;
	}
	.order-cont{
		border: 1px solid #CCCCCC;
		background-color: #FFFFFF;
	}
	.order-cont .order-no{
		border-bottom: 2px solid #CCCCCC;
		line-height: 56rpx;
		background-color: #f1f1f1;
		font-size: 28rpx;
		color: #808080;
		padding-left: 22rpx;
	}
	.order-cont .order-prod{
		display: flex;
		align-items: flex-start;
		justify-content: center;
		padding: 20rpx 0;
		position: relative;
	}
	.order-prod .info{
		width: 395rpx;
		margin: 0 12rpx;
	}
	.order-prod .pimg{
		width: 102rpx;
		height: 135rpx;
	}
	.order-prod .title{
		color: #222222;
		font-size: 30rpx;
		height: 80rpx;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}
	.order-prod .gay{
		color: #828282;
		font-size: 28rpx;
	}
	.order-prod .price{
		color: #212121;
		font-size: 28rpx;
	}
	.order-remark{
		width: 690rpx;
		margin: 30rpx auto;
	}
	.displace-order-list{
		background: #fff;
		position: fixed;
		bottom: 0;
		width: 100%;
		left: 0;
		z-index: 12;
		transform: translateY(100%);
		transition: .3s;
		padding: 15rpx 0;
	}
	.displace-order-list .list-title{
		text-align: center;
		line-height: 68rpx;
		color: #313131;
		font-size: 32rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0 35rpx;
	}

	.displace-order-list .list-title .ok{
		color: #eb1b1b;
	}
	.displace-order-list .list-cont{
		width: 715rpx;
		margin: 0 auto;
		max-height: 800rpx;
	}
	.displace-order-list .list-cont .order-cont{
		margin-top: 20rpx;
	}
	.displace-order-list .list-cont .info{
		width: 400rpx;
	}
	.displace-order-list .list-cont .action{
		position: absolute;
		bottom: 7rpx;
		right: 13rpx;
		width: 44rpx;
		height: 40rpx;
	}
	
	.coupon-cont{
		position: relative;
		z-index: 2;
		&-list{
			max-height: 950rpx;
			&-item{
				width: 700rpx;
				height: 194rpx;
				margin: 0 auto;
				background-color: #FFFFFF;
				border-radius: 5px;
				box-shadow:0px 0px 29rpx rgba(214,214,214,0.24);
				overflow: hidden;
				margin-top: 20rpx;
				&-no{
					color: #4e4e4e;
					font-size: 26rpx;
					border-bottom: 1px solid #e6e6e6;
					line-height: 56rpx;
					padding-top: 6rpx;
					padding-left: 20rpx;
					box-sizing: border-box;
					display: flex;
					justify-content: space-between;
					align-items: center;
					&-text{
						color: #d71511;
						font-size: 26rpx;
						margin-right: 32rpx;
						text{
							font-size: 62rpx;
						}
					}
				}
				&-red{
					color: #d71511;
					font-size: 26rpx;
					margin: 0 30rpx 0 18rpx;
				}
				&-info{
					justify-content: space-between;
					align-items: center;
					height: 130rpx;
					position: relative;
					&-left{
						align-items: center;
						margin-left: 40rpx;
					}
					&-pack{
						width: 63rpx;
						height: 72rpx;
						display: block;
						margin-right: 22rpx;
					}
					&-money{
						color: #353535;
						font-size: 41rpx;
					}
					&-time{
						color: #333333;
						font-size: 28rpx;
					}
					&-selected{
						position: absolute;
						right: 50rpx;
						top: 50%;
						transform: translateY(-50%);
						&-icon{
							width: 46rpx;
							height: 38rpx;
						}
					}
				}
			}
		}
		&-give{
			margin-top: 70rpx;
			&-title{
				align-items: center;
				color: #000000;
				font-size: 36rpx;
				padding-left: 43rpx;
				&-icon{
					width: 41rpx;
					height: 34rpx;
					margin-right: 15rpx;
				}
			}
			&-item{
				color: #000000;
				&-name{
					font-size: 34rpx;
				}
				&-first{
					border-bottom: 1px solid #eaeaea;
					height: 82rpx;
					align-items: center;
					width: 700rpx;
					margin: 0 auto;
					padding-left: 20rpx;
					box-sizing: border-box;
				}
				&-idinput{
					margin-left: 28rpx;
				}
				&-second{
					margin-left: 42rpx;
					.name{
						line-height: 96rpx;
					}
				}
				&-noinput{
					background-color: #eaeaea;
					border-radius: 5px;
					width: 614rpx;
					padding: 15rpx 25rpx;
					font-size: 26rpx;
				}
			}
		}
	}
</style>
<template>
    <view class='page'>
        <view class="g-address">
            <view class="m-address-info" @tap="chooseAddress">
                <view v-if="isAddress" class="m-no-address">点击添加收货地址</view>
                <view v-if="!isAddress" class="m-address-info-l">
                    <view class="m-address-info-t">
                        <view class="u-address-name">{{addressData.realname}}</view>
                        <view class="u-address-mobile">{{addressData.mobile}}</view>
                    </view>
                    <view class="u-address-content">{{addressData.province_text+addressData.city_text+addressData.zone_text+addressData.address}}</view>
                </view>
                <view class="m-address-info-r">
                    <arrow size="50" color="#656565" direction="right"></arrow>
                </view>
            </view>
			<image src="../../../static/icons/jewel/addr_bg.png" mode="" class='m-address-bg'></image>
        </view>

        <!-- 商品详情 -->
        <view class='good-box'>
            <view class='common'>
                <view class='common-box content-box'>
                    <view class='com-name'>广东恒朗</view>
                    <view class='com-contact'>
                        <button open-type="contact" class='contact'>
                            <image src='../../../static/icons/jewel/order_msg.png'></image> 联系商家
                        </button>
                    </view>
                </view>
            </view>
            <!--珠宝-->
            <view class='good'>
                <view class='lease content-box'>
                    <view class='lease-img'>
                        <image :src='order.photo' mode="aspectFit"></image>
                    </view>
                    <view class='lease-info'>
                        <view class='lease-title'>{{order.goods_name}}</view>
                        <view class='lease-attr font-color-hs'>{{order.item_names}}</view>
                    </view>
                    <view class='lease-price'>
                        <view>¥{{order.shop_price}}</view>
                        <view class='lease-num font-color-hs'>x{{buy_number}}</view>
                    </view>
                </view>
            </view>
			
			<!-- <view class="displace-order">
				<view class="d-title"><text>置换订单</text><text @tap="chooseOrder">选择订单></text></view>
				<view class="order-cont" v-if="replace_prod.price_type">
					<view class="order-no">订单号 {{replace_prod.order.order_no}}</view>
					<view class="order-prod">
						<view><image :src='replace_prod.order.goods_img' class="pimg"></image></view>
						<view class="info"><text class="title">{{replace_prod.order.goods_name}}</text><text class="gay">{{replace_prod.order.item_names}}</text></view>
						<view><text class="price">￥{{replace_prod.order.count_amount||0}}</text><br><text class="gay">X{{replace_prod.order.buy_num}}</text></view>
					</view>
				</view>
			</view> -->
			
            <view class='order-remark'>
                <input placeholder="有特别需求的，可以在这里填写喔~" class='input-content' @blur="log_content" />
            </view>
        </view>
		<!-- 订单结算 -->
        <view class="total_price">
			<view class="price_box">
				<view class="single_price">
					<view class="price_title">
						宝贝金额
					</view>
					<view class="price single_price_text">
						¥{{order_total}}
					</view>
				</view>
				<view class="single_price">
					<view class="price_title">
						宝贝数量
					</view>
					<view class="price single_price_text">
						*{{buy_number}}
					</view>
				</view>
				<!-- <view class="single_price">
					<view class="price_title">
						珠宝流量 总：{{mammonTraffic}}
					</view>
					<view class="mammon_input">
						<text v-if="mammonTraffic == 0">暂无可用流量</text>
						<input v-else type="number" @blur="mamInput" v-model="mammonNum" placeholder="可抵扣流量" />
					</view>
				</view> -->
				<view class="single_price">
					<view class="price_title">
						优惠券
					</view>
					<!-- <view class="price single_price_text">
						<text v-if="couponTpye.length === 0">暂无优惠券</text>
						<block v-else>
							<picker @change="bindPickerChange" :value="couponTpyeIndex" :range="couponTpye">
								<view class="uni-input">可抵扣¥{{couponTpye[couponTpyeIndex]}}</view>
							</picker>
						</block>
					</view> -->
					<view class="price single_price_text" @tap="couponBtn('show')">
						{{couponId?couponTxt:'选择优惠券'}}
					</view>
				</view>
				<view class="single_price shareId_input" v-if="isGoodType && !options.record_id && options.seller_id == 0">
					<view class="price_title">
						输入分享ID
					</view>
					<view class="price share-input">
						<input type="number" v-model="shareId" placeholder="可填" />
					</view>
				</view>
			</view>
			<view class="total_pay single_price_text">
				实付金额：¥{{mammon_total}}
			</view>
		</view>
		<!-- 置换结算 -->
		<!-- <view class="total_price">
			<view class="price_box">
				<view class="single_price">
					<view class="price_title">
						置换宝贝金额
					</view>
					<view class="price single_price_text">
						¥{{order_count_amount}}
					</view>
				</view>
				<view class="single_price">
					<view class="price_title">
						原订单金额
					</view>
					<view class="price single_price_text">
						¥{{order.shop_price}}
					</view>
				</view>
			</view>
		    <view class="total_pay single_price_text">
		    	实付差价：¥{{replace_prod.diff_price||0}}
		    </view>
		</view> -->
		
		<view class="help-pay" v-if="pay_for_state == 1" @tap="pay('help')">
			<text class="help-pay-text">帮我付</text>
			<arrow size="40" color="#807f7f" direction="right"></arrow>
		</view>
		
		<view class="pay-btn-bg"></view>
		<view class="pay-btn" @tap="payBtn">确认支付</view>
		
		<view class="u-popup-mask" v-if="payPop" @tap="payBtn" @touchmove.stop=""></view>
		<view class="pay_type_box" :class="[payPop?'z-show':'']">
			<view class="pay-title">请选择支付方式</view>
			<view v-for="(item, index) in payList" :key="index">
				
				<view class="pay_type" @tap="pay(item.type)">
					<view class="left"><image :src="item.icon_text" class="icon_text"></image>{{item.name}}</view>
					<image class="arrow" v-if="paytype == item.type" src="../../../static/icons/pay-select-act.png"></image>
				</view>
			</view>
		</view>
		
		<view class="u-popup-mask" v-if="couponPop" @tap="couponBtn('hide')" @touchmove.stop=""></view>
		<view class="pay_type_box coupon_type_box" :class="[couponPop?'z-show':'']">
			<view class="pay-title"><text class="pay-title-cancelTxt" @tap="cancelCoupon">取消选择</text>请选择优惠券</view>
			<scroll-view scroll-y class="coupon-cont-list"  @scrolltolower="loadMore('coupon')">
				<view class="coupon-cont-list-item" :class="{gray:Number(item.amount) >= Number(order_total) || item.state == 3}" v-for="(item,index) in couponList" :key="index" @tap="chooseCoupon(item.id,item.amount,item.state)">
					<view class="coupon-cont-list-item-no">
						<text>NO: {{item.coupon_no}}</text>
						<view class="coupon-cont-list-item-no-text">{{item.state == 3 || Number(item.amount) >= Number(order_total)?'不可用':item.state_text}}</view>
					</view>
					<view class="coupon-cont-list-item-info flex">
						<view class="coupon-cont-list-item-info-left flex">
							<image class="coupon-cont-list-item-info-pack" src="../../../static/icons/redpacket.png"></image>
							<view>
								<view class="coupon-cont-list-item-info-money">￥{{item.amount}}</view>
								<view class="coupon-cont-list-item-info-time">有效期:{{item.expired_time_text}}</view>
								<view class="coupon-cont-list-item-info-selected" v-if="item.selected">
									<image class="coupon-cont-list-item-info-selected-icon" src="../../../static/icons/jewel/displace-up.png"></image>
								</view>
							</view>
						</view>
						
					</view>
				</view>
				<mix-load-more :status="loadMoreStatus"></mix-load-more>
			</scroll-view>
		</view>
		
		<!-- 选择置换订单 -->
		<!-- <view class="u-popup-mask" v-if="showDisplace" @tap="chooseOrder" @touchmove.stop=""></view>
		<view class="displace-order-list" :class="[showDisplace?'z-show':'']">
			<view class="list-title"><text class="cancel" @tap="chooseOrder">取消</text><text>选择订单</text><text class="cancel ok" @tap="replaceConfirm">确定</text></view>
			<scroll-view scroll-y class="list-cont" @scrolltolower="loadMore('replace')">
				<view class="order-cont" v-for="(item,index) in replaceList" :key="index" @tap="replaceOrder(item.order_no,index)">
					<view class="order-no">订单号 {{item.order_no}}</view>
					<view class="order-prod">
						<view><image :src='item.goods_img' class="pimg"></image></view>
						<view class="info"><text class="title">{{item.goods_name}}</text><text class="gay">{{item.item_names}}</text></view>
						<view><text class="price">￥{{item.count_amount||0}}</text><br><text class="gay">X{{item.buy_num}}</text></view>
						<image :src="index== replaceIdx?'../../../static/icons/jewel/displace-up.png':'../../../static/icons/jewel/displace-off.png'" class="action"></image>
					</view>
				</view>
			</scroll-view>
		</view> -->
		
		<view class="m-full-loading" v-if="bIsShowLoading">
			<view class="m-loading">
				<image src="../../../static/images/loading.gif" mode="widthFix"></image>
				<text>加载中</text>
			</view>
		</view>
    </view>
</template>
<script>
    import jewel from '@/common/common_zb.js';
    export default {
        data() {
            return {
                goods_id: 0,    // 商品id
                choose_item_id: 0,  // 规格id
                buy_number: 1,  // 购买件数
                order: [],  // 订单信息
                isAddress: false,
                addressData: {}, // 地址信息
                addressId: '',  // 地址id
				order_no: 0,	// 订单id（首次点击支付会生成订单id，或从订单列表进来）
				payList: [],	// 支付方式列表
				order_content: '',	// 订单备注
				order_total: 0,	// 订单总价格
				bIsShowLoading: false,
				chuangke_num: '',
				options: {},
				idcard_name: '',	// 身份证名称
				idcard_num: '',	// 身份证号码
				payPop: false,
				bIsShowFefund: false,
				isGoodType:jewel.isGoodsTpye(),
				mammonNum: 0,
				mammonTraffic:0,
				mammon_total:0,
				paytype:'',
				showDisplace:false,
				replaceList:[],
				replace_prod:{},
				replaceIdx:-1,
				replacePage:1,
				replaceTotal_pages:1,
				order_count_amount:0,
				shareId:'',
				couponTpyeIndex:0,
				couponTpye:[],
				couponList:[],
				couponPop:false,
				couponPage:1,
				couponTotal_pages:1,
				loadMoreStatus:0,
				couponId:'',
				couponTxt:'选择优惠券',
				use_coupon:1,
				pay_for_state:1
            }
        },
        onLoad(options) {
            let that = this;
			that.options = options;
            that.goods_id = options.goods_id;
            that.choose_item_id = options.choose_item_id;
			that.use_coupon = options.use_coupon
			that.bIsShowLoading = true;
			let address_id = options.address_id;
			if(address_id) {
				jewel.get('member/address_view',{id: address_id},true,function(res){
					that.addressData = res.data.data;
					that.addressId = address_id;
				});
				
			}else{
				jewel.get('member/address',{},true,function(res){
				    if (!res.data.data.length) {
				        that.isAddress = true
				        return false;
				    }
				    that.addressData = res.data.data[0];
					that.addressId = that.addressData.id;
				});
			}
			var loadData = {};
			if(options.order_no) {
				that.order_no = options.order_no;
				loadData = {order_no: this.order_no};
			}else{
				loadData = {choose_item_id: options.choose_item_id, goods_id: options.goods_id, buy_number: options.buy_number, pay_money:options.pay_money};
			}
			new Promise((resolve, reject) => {
			    jewel.get('goods/getOrderInfo', loadData, true, function(res){
			        let res_data = res.data;
			        if(res_data.code == '-1') {
			            jewel.showToast(res_data.msg)
			            setTimeout(function (){
			                uni.navigateBack();
			            }, 1000)
			        }else{
			            let resdata = res_data.data;
			            that.buy_number = resdata.buy_number;
						that.mammonTraffic = resdata.traffic;
			            that.order = resdata;
						that.order_total = that.mammon_total = Number(resdata.order_total).toFixed(2);
						that.pay_for_state = resdata.pay_for_state
						
						if(resdata.cardinfo != null) that.idcard_name = resdata.cardinfo.realname;
						if(resdata.cardinfo != null) that.idcard_num = resdata.cardinfo.idcard;
						if(that.chuangke_num != '0') that.chuangke_num = resdata.chuangke_num;
			    		resolve();
			        }
			    })
			}).then(() => {
				let data = {goods_id:that.goods_id,is_lottery:1}
				
				jewel.get('Payment/payList', data, true, function (res){
					that.payList = res.data.data;
					that.bIsShowLoading = false;
				})
				that.getCouponData()
			})
			
        },
        methods: {
			mamInput(e){
				let that = this
				let val = e.target.value
				if(Number(val) > Number(that.mammonTraffic)){
					uni.showToast({
						icon:'none',
						title:'超过可用流量'
					})
				}else{
					jewel.post('order/count_price', {order_total:that.order_total,traffic:val}, true, function (res){
						that.mammon_total = res.data.data.order_total
					})
				}
			},
			// 选择地址
			chooseAddress(){
				var url = '/pages/user/settings/address/address?';
				if(this.order_no) {
					url+= 'order_no='+ this.order_no;
				}else{
					url+= 'choose_item_id='+this.choose_item_id+'&goods_id='+this.goods_id+'&buy_number='+this.buy_number+'&pay_money='+this.options.pay_money+'&use_coupon='+this.use_coupon+'&is_daiyan_zone='+this.options.is_daiyan_zone+'&record_id='+this.options.record_id+'&seller_id='+this.options.seller_id
				}
				uni.navigateTo({
					url: url
				})
			},
			// 支付
			pay(paytype){
				let that = this;
				that.payPop = false;
				
				that.paytype = paytype
				// #ifdef H5
				var source = 1;	// 公众号
				// #endif
				// #ifdef APP-PLUS
				var source = 2;	// App
				// #endif
				// #ifdef MP-WEIXIN
				var source = 3;	// 小程序
				// #endif
			
				var loadData = {
					type: paytype, source: source, chuangke_num: that.chuangke_num,
					idcard_name: that.idcard_name, idcard_num: that.idcard_num,
					order_content: that.order_content,traffic:that.mammonNum,
					rec_id: that.shareId
				};
				if(that.order_no) {
					loadData.order_no = that.order_no;
				}else{
					loadData.goods_id = that.goods_id;
					loadData.choose_item_id = that.choose_item_id;
					loadData.buy_number = that.buy_number;
					loadData.address_id = that.addressId;
					loadData.pay_money = that.options.pay_money
					if(that.options.is_daiyan_zone == 1 && that.couponId) loadData.coupon_id = that.couponId
					if(that.options.record_id) loadData.record_id = that.options.record_id
				}
				if(paytype != 'help'){
					uni.showModal({
						title: '提示',
						content: '确认享用该订单吗',
						success: function (res) {
							if (res.cancel) {
								return false
							}
							if (res.confirm) {
								that.bIsShowLoading = true;
								jewel.post('Order/order', loadData, true, function (res){
									that.bIsShowLoading = false;
									let data = res.data;
									if(data.code =='-1'){
										jewel.showToast(data.msg, 1500);
									}else if(data.code == '-2'){	// 如果订单信息不存在，返回首页
										setTimeout(function (){
											uni.switchTab({
												url: '/pages/jewel/index/index'
											})
										}, 1000)
									}else{
										that.chuangke_num = '';
										that.order_no = data.data.order_no;
										switch (loadData.type) {
										    case 'wxpay':
											case 'alipay':
												let pay_data = data.data.paydata;
										        uni.requestPayment({
										            provider: loadData.type,
										            orderInfo: pay_data,
													// #ifdef MP-WEIXIN
													nonceStr: pay_data.nonceStr,
													timeStamp: pay_data.timeStamp,
													package: pay_data.package,
													signType: pay_data.signType,
													paySign: pay_data.paySign,
													// #endif
										            success: (res) => {
										                jewel.showToast('支付成功', 1500);
										                uni.navigateTo({
										                	url:'/pages/jewel/order/ordersuccess?order_no='+that.order_no
										                })
										            },
										            fail: (res) => {
										                jewel.showToast('支付失败');
										            },
													complete:(res)=>{
													}
										        })
										        break;
											case 'treasure_chest':
											case 'youpin_credit_pay':
											case 'red_money_pay':
										    case 'jewel_granary':
												if (data.code == 3) {
												    setTimeout(() => {
												        uni.navigateTo({
												            url:'/pages/jewel/order/ordersuccess?order_no='+that.order_no
												        })
												    }, 500)
												}
										        break;
										}
									}
								})
							}
						}
					})
				}else{
					loadData.type = 'wxpay'
					loadData.coupon_id = ''
					uni.navigateTo({
						url:'/pages/credit/credit_helppay?data='+JSON.stringify(loadData)
					})
				}
			},
			// 记录额外描述
			log_content(e){
				this.order_content = e.target.value;
			},
			// 记录身份证名称
			log_idcardname(e){
				this.idcard_name = e.target.value;
			},
			// 记录身份证号码
			log_idcardnum(e){
				this.idcard_num = e.target.value;
			},
			// 修改创客
			payBtn(){
				let that = this
				// if(Number(that.mammonNum) > Number(that.mammonTraffic)){
				// 	uni.showToast({
				// 		icon:'none',
				// 		title:'超过可用流量'
				// 	})
				// 	return false
				// }
				this.payPop = !this.payPop;
			},
			getreplaceList(type){
				let that = this
				if(that.replacePage <= that.replaceTotal_pages){
					that.bIsShowLoading = true
					jewel.post('order/replacement_list', {page:that.replacePage}, true, function (res){
						that.bIsShowLoading = false
						if(type=='plus'){
							that.replaceList = that.replaceList.concat(res.data.data.data)
						}else{
							that.replaceList = res.data.data.data
							that.replaceTotal_pages = res.data.data.total_pages
						}
					})
				}
			},
			//选择置换订单
			chooseOrder(type){
				let that = this
				that.showDisplace = !that.showDisplace;
				if(that.showDisplace){
					that.getreplaceList()
				}else{
					that.replace_prod = {}
					that.replaceIdx = -1
				}
			},
			replaceConfirm(){
				let that = this
				if(that.replaceIdx != -1){
					let data = {
						order_no:that.replace_prod.order_no,
						goods_id:that.options.goods_id,
						buy_number:that.options.buy_number,
						choose_item_id:that.options.choose_item_id
					}
					that.bIsShowLoading = true;
					jewel.post('order/replace_order', data, true, function (res){
						that.bIsShowLoading = false
						if(res.data.code == 0){
							that.replace_prod = res.data.data
							that.order_count_amount = res.data.data.order.count_amount
						}else{
							jewel.showToast(res.data.msg)
						}
					})
				}
				that.showDisplace = false
				
			},
			replaceOrder(order_no,index){
				let that = this
				that.replaceIdx = index
				that.replace_prod.order_no = order_no
			},
			loadMore(type) {
				switch(type){
					case 'coupon':
						// this.couponPage = ++this.couponPage
						// this.getCouponData('more')
					break;
					case 'replace':
						this.replacePage = ++this.replacePage
						this.getreplaceList('plus')
					break;
				}
			},
			couponBtn(type) {
				if(type == 'hide'){
					this.couponPop = false
				}else{
					this.couponPop = true
				}
			},
			getCouponData(type){
				let that = this
				that.loadMoreStatus = 1
				let data = {
					state:0,
					goods_id:that.goods_id,
					buy_number:that.buy_number,
					choose_item_id:that.choose_item_id
				}
				if(that.couponPage <= that.couponTotal_pages){
					jewel.get('Maker/coupon_list',data,true,function(res){
						if(res.data.data.length === 0) that.loadMoreStatus = 2
						if(type == 'more'){
							that.couponList = that.couponList.concat(res.data.data)
						}else{
							that.couponList = res.data.data
							that.couponTotal_pages = res.data.total_pages
							that.loadMoreStatus = that.couponTotal_pages == 1||that.couponTotal_pages == 0?2:0
						}
						for(let i in that.couponList){
							that.couponList[i].selected = false
						}
					});
				}else{
					that.loadMoreStatus = 2
				}
			},
			chooseCoupon(id,amount,state){
				let that = this
				
				if(state == 3 || Number(amount) >= Number(that.order_total)) return false
				that.couponBtn('hide')
				that.mammon_total = Number(that.order_total) - Number(amount)
				that.couponTxt = '可抵扣'+ amount
				for(let i in that.couponList){
					if(that.couponList[i].id == id){
						that.couponList[i].selected = true
						that.couponId = id
					}else{
						that.couponList[i].selected = false
					}
				}
			},
			cancelCoupon(){
				let that = this
				for(let i in that.couponList){
					that.couponList[i].selected = false
				}
				that.couponBtn('hide')
				that.couponId = ''
				that.mammon_total = that.order_total
			}
        }
    }
</script>
<style lang="scss" scoped>
    page {
        background: #efefef;
        /*小程序最外层默认有一个page标签*/
    }
    .g-address{
        border-top: 2rpx solid #ddd;
		overflow: hidden;
		height: auto;
    }
    .m-no-address{
        padding-left: 40upx;
        font-size: 30upx;
    }
    .m-address-info{
        width: 100%;
        position: relative;
        padding: 20upx 0;
        background: #ffffff;
    }
    .m-address-info-l{
        width: 600upx;
        margin-left: 40upx;
    }
    .m-address-info-r{
        position: absolute;
        right: 20upx;
        top: 50%;
        transform: translateY(-50%);
    }
    .m-address-info-t{
        display: flex;
        align-items: center;
        height: 40upx;
        margin-bottom: 18upx;
        font-size: 32upx;
    }
    .u-address-name,.u-address-mobile{
        font-weight: bold;
        margin-right: 20rpx;
    }
    .u-address-content{
        font-size: 29upx;
        color: #5f5f5f;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }
    .m-address-bg{
        width: 100%;
        height: 8upx;
		position: relative;
		top: -20rpx;
    }

    .page {
        background: #efefef;
        width: 100%;
        height: 100%;
        overflow: hidden;
        font-family: '微软雅黑'
    }

    .font-color-hs {
        color: #999;
    }

    .addr_bg {
        height: 9rpx;
        width: 100%
    }


    .good-box {
        height: auto;
        width: 100%;
        overflow: hidden;
		background: #FFFFFF;
    }

    .common {
        border-bottom: 1px solid #ddd;
        height: 102rpx;
        width: 100%;
        line-height: 102rpx;
    }

    .content-box {
        width: 92%;
        height: 100%;
        margin: 0 auto;
        font-size: 28rpx;
		margin-bottom: 20rpx;
    }

    .com-name {
        float: left;
    }

    .com-contact {
        float: right;
        color: #666;
		padding-top: 24rpx;
    }

    .com-contact image {
        width: 39rpx;
        height: 39rpx;
        position: relative;
        top: 10rpx;
    }

    .good {
        height: 246rpx;
        width: 100%;
        overflow: hidden;
        border-bottom: 1px solid #ddd;
        margin-top: 30rpx;
    }

    .lease-img {
        float: left;
        width: 144rpx;
        height: 144rpx;
        border: 2rpx solid #d8d8d8;
        margin-right: 21rpx;
    }

    .lease-img image {
        width: 100%;
        height: 100%
    }

    .lease-info {
        width: 376rpx;
        float: left;
        font-size: 26rpx;
    }

    .lease-title {
        height: 74rpx;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }

    .lease-attr {
        height: 88rpx;
        overflow: hidden;
        font-size: 24rpx;
        margin-top: 10rpx;
    }

    .lease-price {
        float: right;
        font-size: 26rpx;
    }

    .lease-num {
        margin-top: 14rpx;
    }

    .lease-market-price {
        text-decoration: line-through;
    }

    .package {
        display: inline-block;
        font-size: 26rpx;
    }

	
    .total_price{
        background: #fff;
    }
	.price_box{
		width: 690rpx;
		margin: 0 auto;
		border-bottom: 2rpx solid #eee;
	}
	.single_price{
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 95%;
		margin: 0 auto;
		height: 54rpx;
	}
	.total_pay{
		height: 60rpx;
		line-height: 60rpx;
		text-align: right;
		width: 690rpx;
		margin: 0 auto;
	}
	.single_price_text{
		font-size: 16px;
		color: #fd6361;
	}
	.shareId_input{
		margin: 10rpx auto;
	}
	.shareId_input .share-input{
		border: 1px solid #cccccc;
		text-align: center;
		width: 180rpx;
	}
	.pay_type_box{
		background: #fff;
		position: fixed;
		bottom: 0;
		width: 100%;
		left: 0;
		z-index: 10;
		transform: translateY(100%);
		transition: .3s;
	}
	.pay_type_box .pay-title{
		text-align: center;
		color: #313131;
		font-size: 34rpx;
		padding: 30rpx 0;
		position: relative;
	}
	.pay_type_box .pay-title .pay-title-cancelTxt{
		position: absolute;
		left: 20rpx;
		top: 0;
		line-height: 104rpx;
		font-size: 30rpx;
	}
	.pay_type{
		height: 108rpx;
		line-height: 108rpx;
		font-size: 32rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		color: #2b2b2b;
		border-bottom: 1px solid #f0f0f0;
	}
	.pay_type .left{
		display: flex;
		align-items: center;
	}
	.pay_type .icon_text{
		width: 65rpx;
		height: 65rpx;
		margin: 0 30rpx;
		display: block;
	}
	.pay_type .arrow{
		width: 42rpx;
		height: 42rpx;
		display: block;
		margin-right: 30rpx;
	}
	.wxpay{
		background: #06ba04;
	}
	.jewel_granary{
		background: #fd6361;
	}
	.alipay{
		background: #1b95d4;
	}
	.qian_pay{
		background: #f3970d;
	}
    .input-content {
        width: 100%;
        background: #f5f5f5;
        height: 69rpx;
        border-radius: 7rpx;
        font-size: 25rpx;
        padding-left: 22rpx;
		box-sizing: border-box;
    }
	.pay-btn-bg{
		width: 100%;
		height: 100rpx;
	}
	.pay-btn{
		position: fixed;
		left: 0;
		bottom: 0;
		z-index: 10;
		width: 100%;
		background: #d71311;
		color: #fff;
		text-align: center;
		height: 100rpx;
		line-height: 100rpx;
		font-size: 32upx;
		box-sizing: border-box;
	}
	.z-show {
	    transform: translateY(0) !important;
	}
	.u-popup-mask {
	    position: fixed;
	    left: 0;
	    top: 0;
	    width: 100vw;
	    height: 100vh;
	    background: rgba(0, 0, 0, .5);
	    z-index: 10;
	}
	.m-full-loading{
		background-color: transparent;
	}
	.gray{     
	 -webkit-filter: grayscale(100%);   
	  -moz-filter: grayscale(100%);  
	   -ms-filter: grayscale(100%);   
	  -o-filter: grayscale(100%);     
	     filter: grayscale(100%); 	     
	 
	filter: gray; }
	
	.help-pay{
		display: flex;
		justify-content: space-between;
		background-color: #FFFFFF;
		margin-top: 20rpx;
		align-items: center;
		padding: 0 35rpx;
		height: 80rpx;
	}
</style>